package com.cgy.springboot.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    // 文件上传路径（应与FileController中的一致）
    private static final String UPLOAD_PATH = "file:/c:/Users/llk/Desktop/wxapp-spring-boot/SpringBoot/src/main/java/com/cgy/springboot/images/";
    
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 配置静态资源映射，支持/images/**
        registry.addResourceHandler("/images/**")
                .addResourceLocations(UPLOAD_PATH);
    }
}